/*
 * 
 * Created on Jul 29, 2005
 */
package com.wgo.precise.client.ui.view.util;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;

import com.wgo.precise.client.ui.model.facade.ILabelProviderItem;
import com.wgo.precise.client.ui.model.facade.IModelPersistable;


/**
 * 
 * @author Petter L. H. Eide
 * @version $Id: EditorInput.java,v 1.2 2006-01-30 21:52:32 petterei Exp $
 * 
 * Changelog:
 * 
 * $Log: EditorInput.java,v $
 * Revision 1.2  2006-01-30 21:52:32  petterei
 * implemented wrapper factory and lazy wrapper-instantiation of parents
 * implemented a "system" for each top-node type
 * added top-categories for all top-nodes
 * implemented some interfaces for the wrappers, and started using these
 *
 * Revision 1.1  2006-01-23 19:58:37  petterei
 * initial commit for client, fitting the alternative session implementation
 *
 * Revision 1.4  2006-01-13 08:13:20  petterei
 * Using Long consequently to differentiate between �null� and �0� for dbId and conceptId (no boxing/unboxing)
 * Ajusted code to stronger java-syntax
 *
 * Revision 1.3  2005-12-05 04:16:40  petterei
 * *** empty log message ***
 *
 * Revision 1.2  2005-11-16 16:43:28  petterei
 * mye testing...
 *
 * Revision 1.1  2005/10/11 15:08:03  petterei
 * Seccond iteration:
 * 1. Eclipse based client with new domain model
 * 2. Flexible Project and Category hierarchy with Drag-n-Drop functionality
 * New functionality:
 * 3. Eclipse plugin update-site
 *
 * Revision 1.1  2005/08/23 06:38:13  peide3
 * *** empty log message ***
 *
 * Revision 1.1  2005/07/31 22:55:10  petterei
 * initial commit
 *
 *
 */
public class EditorInput implements IEditorInput {

    private IModelPersistable item;
    /**
     * 
     */
    public EditorInput(IModelPersistable item) {
        this.item = item;
    }

    /**
     * @see org.eclipse.ui.IEditorInput#exists()
     */
    public boolean exists() {
        return false;
    }

    /**
     * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
     */
    public ImageDescriptor getImageDescriptor() {
//        return item.getImage();
        return null;
    }

    /**
     * @see org.eclipse.ui.IEditorInput#getName()
     */
    public String getName() {
        String text = "";
        if (item != null ) {
            text = item.getText();
        }
        return text;
    }

    /**
     * @see org.eclipse.ui.IEditorInput#getPersistable()
     */
    public IPersistableElement getPersistable() {
        return new ModelPersistable(item);
    }

    /**
     * @see org.eclipse.ui.IEditorInput#getToolTipText()
     */
    public String getToolTipText() {
        String text = "";
        if (item != null ) {
            text = item.getToolTipText();
        }
        return text;
    }

    /**
     * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
     */
    @SuppressWarnings("unused")
    public Object getAdapter(Class adapter) {
        return null;
    }
    
    public ILabelProviderItem getModelItem(){
    	return item;
    }
}
